package indi.gtl.superbrain.widget;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.RectF;
import android.util.AttributeSet;
import android.view.View;

public class shapeview extends View{
	int s=0;
	int a=3;;
	
	public shapeview(Context context){
		this(context, null);
	}
	
	public shapeview(Context context, AttributeSet attr) {
		super(context, attr);
		// TODO Auto-generated constructor stub
	}

	public void reflash_s(){
		s++;
		if(s<=360){
			invalidate();
		}
		
	}
	public void reflash_a(){
		a--;
		invalidate();
	}
@Override
protected void onDraw(Canvas canvas) {
	
	// TODO Auto-generated method stub
	super.onDraw(canvas);
	int w = getWidth();
	int h = getHeight();
	int r = w > h ? h / 2 : w / 2;
	Paint p = new Paint();  
	Paint pyuan = new Paint();
	Paint pshu = new Paint();
    p.setColor(Color.YELLOW);
    pshu.setStrokeWidth(15);
    pyuan.setStrokeWidth(20);
    pyuan.setColor(Color.BLUE);
    p.setStrokeWidth(20);
    pshu.setTextSize(150);
    p.setStyle(Paint.Style.STROKE);//设置空心  
    pyuan.setStyle(Paint.Style.STROKE);
    RectF oval1=new RectF(w / 2 - r+10, h / 2 - r+10, w / 2 + r-10, h / 2 + r-10);   
   canvas.drawArc(oval1, 0, 360, false, p);
   canvas.drawArc(oval1, 270, s, false, pyuan);//小弧形 
   canvas.drawText(a+"", w/2-r*3/7,h/2+r*5/9, pshu);
}
}
